<!DOCTYPE html>
<html lang="en">
    <head>
        <title></title>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <script src="../js/vue.js"></script>
        <script src="../js/axios.js"></script>
    </head>
    <body>
        <div id="app">
            <input type="button" value="get请求" @click='getGet'>

            <input type="button" value="post请求" @click='getPoss'>


        </div>
        <script>
            var vm = new Vue({
                el: '#app',
                data: {
                    pig : {
                        id : 1,
                        name : 'zhu'
                    }
                },
                methods : {
                    getGet(){
                        // 不传参
                        // axios.get('url')
                        // 两种传参
                        // axios.get('url?id=111')
                        axions.get('url',{parmas:{id:111}})
                        // 操作成功的回调函数
                        .then((res)=>{
                            console.log(res)
                        })
                        // 操作失败的回调函数
                        .catch((err)=>{
                            console.log(err)
                        })
                    },
                    getPoss(){
                        // 这有这一种
                        // axions.poss('url',{})
                        axions.poss('url',this.pig)
                    }
                }
            })
        </script>
    </body>
</html>